package com.heima.wemedia.listers;
/*
    
 需求描述：
 @Author: wang
 @Date: 2022/10/18 22:23
 
 */

import com.alibaba.fastjson.JSON;
import com.heima.model.wemedia.dtos.WmNewsDto;
import com.heima.wemedia.service.WmNewsAutomaticCheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
public class KafkaEnableLister {
    @Autowired
    private WmNewsAutomaticCheckService automaticCheckService;
    @KafkaListener(topics = "news_enable_topic")
    public void onMsg(String msg) throws Exception {
        WmNewsDto wmNewsDto = JSON.parseObject(msg, WmNewsDto.class);
        automaticCheckService.dataSynchronization(wmNewsDto.getId());
    }

}
